<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * date: 2021-12-03 13:53:55
 * @LastEditors: Sam
 * @LastEditTime: 2022-04-28 09:08:53
 */
namespace app\__MODULE__\model;

class BargainLog extends BaseModel{

	    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $name = 'bargain_log';



     public function help(){
    	return $this->belongsTo(User::class,'help_id')->bind(['nickname','avatar']);
    }

     public function user(){
        return $this->belongsTo(User::class,'uid')->bind(['nickname','avatar']);
    }

     public function activity(){
        return $this->belongsTo(Bargain::class,'aid')->bind(['title']);
    }


      public function helpTo(){
        return $this->belongsTo(User::class,'uid')->bind(['to_nickname'=>'nickname','to_mobile'=>'mobile']);
    }

    public function helpFrom(){
        return $this->belongsTo(User::class,'help_id')->bind(['from_nickname'=>'nickname','from_mobile'=>'mobile']);
    }

    public function getCreateTimeAttr($value){
    	return date('Y-m-d',$value);
    }
}